package com.wenhao.newcode.huawei;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-21 16:08
 */
public class MainDate {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int date = scanner.nextInt();
        int[] days = new int[]{31,28,31,30,31,30,31,31,30,31,30,31};
        boolean flag29 = false;
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            flag29 = true;
        }
        int result = 0;
        for (int i = 0;i < month - 1;i++) {
            result += days[i];
        }
        if (flag29 && month > 2) {
            System.out.println(result + 1 + date);
        } else {
            System.out.println(result + date);
        }
    }
}
